
<style>
    .fixed-table-pagination .pagination-detail, .fixed-table-pagination div.pagination {
        margin-top: 0px;
        margin-bottom: 0px;
    }
</style>

<div class="container-fluid">
    <div class="row">
        <div class="panel panel-default" style="margin-bottom: 0px;">
            <div class="panel-heading" style="font-weight: bold">
                <span>教育资源投入指标</span>
            </div>
            <div class="panel-body">
                <div id="toolbar" style="margin-bottom: 5px;">
                    <div class="form-inline">
                        <input id="search" class="form-control" placeholder="学院" onkeyup="rateIn.refreshTable()" style="width: 120px">
                        <button class="btn btn-primary btn-sm" onclick="rateIn.clickAdd()">新增</button>
                        <button class="btn btn-danger btn-sm" onclick="rateIn.clickDeleteAll()">批量删除</button>
                        <button class="btn btn-success btn-sm" onclick="importExcel()">导入Excel</button>
                        <button class="btn btn-success btn-sm" onclick="rateIn.exportExcel()">导出Excel</button>
                    </div>
                </div>
                <table id="list-table"></table>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        var h = $(window).height();
        $("#list-table").bootstrapTable({
            url:'getRateInList',
            method:'post',
            sidePagination: 'server',
            pagination:true,
            pageSize:20,
            pageList:[10,20,50],
            pageNumber:1,
            height:h - 210,
            columns:[
                [
                    {
                        checkbox:true
                        ,rowspan:3
                    },
                    {
                        title:'学院'
                        ,rowspan:3
                        ,field:'SHORTNAME'
                        ,sortKey:'COLLEGE_ID'
                        ,sortable:true
                    }
                    ,{
                        title:'人力资源'
                        ,colspan:11
                        ,align:'center'
                    }
                    ,{
                        title:'物力资源'
                        ,colspan:5
                        ,align:'center'
                    }
                    ,{
                        title:'财力资源'
                        ,colspan:4
                        ,align:'center'
                    }
                    ,{
                        title:'学科资源'
                        ,colspan:8
                        ,align:'center'
                    }
                    ,{
                        title:'操作',
                        rowspan:'3',
                        field:'R_IN_ID',
                        halign:'center',
                        align:'center',
                        formatter:eval('rateIn.listButton')
                    }
                ]
                ,[
                    {
                        title:'教职工数量',
                        colspan:6
                        ,align:'center'
                    }
                    ,{
                        title:'专职教师构成',
                        colspan:5
                        ,align:'center'
                    }
                    ,{
                        title:'仪器设备',
                        colspan:3
                        ,align:'center'
                    }
                    ,{
                        title:'学院用房',
                        colspan:2
                        ,align:'center'
                    }
                    ,{
                        title:'教育事业经费支出',
                        colspan:4
                        ,align:'center'
                    }
                    ,{
                        title:'硕博士点',
                        colspan:2
                        ,align:'center'
                    }
                    ,{
                        title:'博士后情况',
                        colspan:1
                        ,align:'center'
                    }
                    ,{
                        title:'优势学科',
                        colspan:3
                        ,align:'center'
                    }
                    ,{
                        title:'科研基地',
                        colspan:2
                        ,align:'center'
                    }
                ]
                ,[
                    {
                        title:'教职工总数',
                        field:'HR_NUM_JZ'
                        ,sortable:true,

                    }
                    ,{
                        title:'专职教师数',
                        field:'HR_NUM_ZJ'
                        ,sortable:true,
                    }
                    ,{
                        title:'行政人员数'
                        ,field:'HR_NUM_XZ'
                        ,sortable:true,
                    }
                    ,{
                        title:'教辅人员数'
                        ,field:'HR_NUM_JF'
                        ,sortable:true
                    }
                    ,{
                        title:'实验人员数'
                        ,field:'HR_NUM_SY'
                        ,sortable:true
                    }
                    ,{
                        title:'外聘教师数'
                        ,field:'HR_NUM_WP'
                        ,sortable:true
                    }
                    ,{
                        title:'博士学历占专职教师比例'
                        ,field:'HR_RATE_BS'
                        ,sortable:true
                    }
                    ,{
                        title:'副高以上专职教师比例'
                        ,field:'HR_RATE_FG'
                        ,sortable:true
                    }
                    ,{
                        title:'35-45岁教师占专职教师比列'
                        ,field:'HR_RATE_35TO45'
                        ,sortable:true
                    }
                    ,{
                        title:'博士生导师数'
                        ,field:'HR_NUM_BD'
                        ,sortable:true
                    }
                    ,{
                        title:'硕士生导师数'
                        ,field:'HR_NUM_SD'
                        ,sortable:true
                    }
                    ,{
                        title:'仪器设备总值'
                        ,field:'MR_FEE_SB'
                        ,sortable:true
                    }
                    ,{
                        title:'教学科研仪器设备总值'
                        ,field:'MR_FEE_JXKY'
                        ,sortable:true
                    }
                    ,{
                        title:'贵重仪器设备占总值比'
                        ,field:'MR_RATE_GZ'
                        ,sortable:true
                    }
                    ,{
                        title:'学院用房总面积'
                        ,field:'MR_AREA_USE'
                        ,sortable:true
                    }
                    ,{
                        title:'教学科研实验用房面积'
                        ,field:'MR_AREA_JXKY'
                        ,sortable:true
                    }
                    ,{
                        title:'总支出'
                        ,field:'FR_FEE_TOTAL'
                        ,sortable:true
                    }
                    ,{
                        title:'教育事业支出'
                        ,field:'FR_FEE_JY'
                        ,sortable:true
                    }
                    ,{
                        title:'科研事业支出'
                        ,field:'FR_FEE_KY'
                        ,sortable:true
                    }
                    ,{
                        title:'生均教育事业支出'
                        ,field:'FR_FEE_SJ'
                        ,sortable:true
                    }
                    ,{
                        title:'博士点数'
                        ,field:'SR_P_BS'
                        ,sortable:true
                    }
                    ,{
                        title:'硕士点数'
                        ,field:'SR_P_SS'
                        ,sortable:true
                    }
                    ,{
                        title:'博士后科研流动站'
                        ,field:'SR_BSH'
                        ,sortable:true
                    }
                    ,{
                        title:'进入一级学科排名前20%学科数'
                        ,field:'SR_XK_1'
                        ,sortable:true
                    }
                    ,{
                        title:'“双一流”建设学科数'
                        ,field:'SR_XK_2'
                        ,sortable:true
                    }
                    ,{
                        title:'省级重点学科数'
                        ,field:'SR_XK_3'
                        ,sortable:true
                    }
                    ,{
                        title:'国家级重点实验室、研究中心、科研基地数（当年）'
                        ,field:'SR_KY_1'
                        ,sortable:true
                    }
                    ,{
                        title:'省部级重点实验室、研究中心、科研基地数（当年）'
                        ,field:'SR_KY_2'
                        ,sortable:true,

                    }
                ]
            ],
            queryParams:function (params) {
                params.search = $("#search").val();
                return params;
            },
            responseHandler:function (res) {
                console.log(res)
                return res;
            }
        });
    });

    var rateIn = {

        listButton: function (value, rowData, index) {
            var html1 = "<button class='btn btn-xs btn-default' R_IN_ID='" + value + "' onclick='rateIn.clickEdit(this)' style='margin: 2px;'>查看</button>";
            return html1;
        }
        ,clickEdit:function (obj) {
            var rateInId = $(obj).attr('R_IN_ID');
            console.log(rateInId);
            var h = $(window).height()*0.9;
            var w = $(window).width()*0.9;
            layer.open({
                title:'查看教育资源投入指标',
                area:[w + 'px', h + 'px'],
                type:2,
                content:"{:url('editPage')}?rateInId=" + rateInId
            });
        }
        ,exportExcel:function () {
            window.open("{:url('exportExcel')}?search=" + $("#search").val());
        }
        ,clickAdd:function () {
            var h = $(window).height()*0.9;
            var w = $(window).width()*0.9;

            layer.open({
                title:'新增教育资源投入指标',
                area:[w + 'px', h + 'px'],
                type:2,
                content:"{:url('addPage')}"
            });
        }
        ,clickDeleteAll:function () {
            var list = $("#list-table").bootstrapTable("getSelections");
            if(list.length < 1){
                layer.alert('请勾选要删除的教育资源投入指标',{icon:2});
                return;
            }

            var idList = [];
            for(var i = 0 ; i < list.length ; i++){
                idList.push(list[i]['R_IN_ID']);
            }

            layer.confirm('确认删除选中的教育资源投入指标吗？',{icon:3},function (index) {
                layer.close(index);
                layer.load();
                $.ajax({
                    url:"{:url('deleteAll')}",
                    data:{list:idList},
                    success:function (res) {
                        layer.closeAll('loading');
                        var json = JSON.parse(res);
                        if(json['code'] == '200'){
                            layer.alert(json['msg'],{icon:1},function (index) {
                                layer.close(index);
                                rateIn.refreshTable();
                            });
                        }
                        else{
                            layer.alert(json['msg'],{icon:2});
                        }
                    },
                    error:function (res) {
                        layer.closeAll('loading');
                        layer.alert('网络错误',{icon:2});
                    }
                });
            });
        }
        ,refreshTable:function () {
            $("#list-table").bootstrapTable('refresh');
        }
    };

    function clickSearch() {
        var h = $(window).height()*0.8;
        var w = $(window).width()*0.8;
        if(w > 1200){
            w = 1200;
        }
        layer.open({
            title:'高级查询--请输入查询条件',
            area:[w + 'px', h + 'px'],
            type:2,
            content:"{:url('searchPage')}"
        });
    }

    function importExcel() {
        var h = $(window).height()*0.8;
        var w = $(window).width()*0.8;
        if(w > 1200){
            w = 1200;
        }
        layer.open({
            title:'导入',
            area:[w + 'px', h + 'px'],
            type:2,
            content:"{:url('rateInImportPage')}",
            end:function () {
                rateIn.refreshTable();
            }
        });
    }

</script>